473,416 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

How do i protect files in directory from being listed and viewed

luckysanj
I am developing the free e-book sites.so i I want to know how to prevent the subfolders from websites.

Means, when we open the home page like www.best4knowledge.com then it first open index page then it's ok but users may be guess that there will be any folder & open like that www.best4knowledge.com/front/ . & it shows all the files but it is not secure for me to show all files.

So plz guide me how can i prevent to that files from un authentic person.

Thank you.
Jul 31 '09 #1
9 4748
Markus
6,050 Expert 4TB
What server are you using? IIS, Apache?
Jul 31 '09 #2
Apache Server Because i am programming on PHP language.
Jul 31 '09 #3
Niheel
2,460 Expert Mod 2GB
one way to do this without setting up secure password is to using an apache .htaccess file

Add the following in a file called .htaccess and upload it to the folder called "front"

Expand|Select|Wrap|Line Numbers
  1. <Directory ~ "\.front">
  2. Order allow,deny
  3. Deny from all
  4. </Directory>
  5.  
The other way to do this is setup a username and then password protect the folder. You'll find an easy to follow howto with complete directions and tools at this url:
http://www.ilisys.com.au/support/lin...sword-protect/
Jul 31 '09 #4
Ok with this method the folder are hidden from browser. But

he link files from subfolder doesn't work. when the index page call the pages from subfolder it can't access.

Then How can i solve ?
Jul 31 '09 #5
Niheel
2,460 Expert Mod 2GB
If you want to stop allowing your users to view the directory's files you can do one of two things:

1) create a blank index.html file and upload it to /front/

or

2) you might try create an .htaccess file with the following code and upload it to your /front folder

Expand|Select|Wrap|Line Numbers
  1. <Directory ~ "\.front"> 
  2. Options -Indexes 
  3. </Directory>
  4.  
Jul 31 '09 #6
Markus
6,050 Expert 4TB
@luckysanj
You can program 'on PHP' using IIS, you know. :)

Going to move this over to Apache.
Jul 31 '09 #7
It doesn't work. It is like same problem. it display all the subfolder pages.
Jul 31 '09 #8
numberwhun
3,509 Expert Mod 2GB
@luckysanj
First, which option did you try? Remember, if you add to your httpd.conf file, you have to restart your apache server for the changes to take effect.

Regards,

Jeff
Jul 31 '09 #9
You can keep an index file(index.html or which ever file you gave in DirectoryIndex) in your "front" directory or which ever directory you want to hide listing of files. It will prevent listing of files and directories.
Aug 1 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Flier_75 | last post by:
Hi, I just password-protected an intranet site by including a password authentication script in each page of a private section. The script checks the login against the mySQL database....
11
by: LarryM | last post by:
Hi, NB, not to stop capturing the single displayed Image, but to stop downloading the entire image directory. (In my Website you will do a search, and get some thumbnails, and these can be...
4
by: LIN | last post by:
Can someone guide me with an article or advice me on how to UPLOAD ASPx files on the webserver. I am making the ASPx pages by creating a project in VS .NET. I have no clue how to deploy the...
8
by: George | last post by:
VS.NET 2002/VB My IIS permissions and folder settings show Read and Execute only. Why is it that I can use any browser and link directly to my DLL file in my BIN folder on my Web site and...
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
4
by: rn5a | last post by:
I have a ListBox which should list all the files & directories that exist in a particular directory. The problem is I can get the ListBox to list either all the files or all the directories but not...
8
by: mdh2972 | last post by:
I would like to put all my .jpg images in a folder into an array to be viewed. can I use JS to do this automatically. Without having to type by hand?
2
by: Eric Layman | last post by:
Hi, We have a remote webhost here that runs dotnet. Interestingly, it is not able to parse any aspx files It will show a run time error even if the aspx file is blank or doesnt even exist....
7
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.